package com.starview.star.compiler.util;

import java.util.Map;



public interface LayeredMap<K, V> extends Map<K, V>, PrettyPrintable
{
  /**
   * Create a fork of this map. New map contains all existing entries; but
   * entries put into the forked map do not show up in this map
   * 
   * @return
   */
  LayeredMap<K, V> fork();

  /**
   * Get the parent layered map
   * 
   * @return
   */
  LayeredMap<K, V> getParent();

  Map<K, V> getSurfaceMap();

  /**
   * Look for an entry in the surface map only. I.e., will not look in any of
   * the parent maps
   * 
   * @param key
   * @return
   */
  V getLocal(K key);

  /**
   * Visit the entries in the map until the visitor says stop, or run out of
   * entries
   * 
   * @param visitor
   * @return stop iff the visitor has said stop
   */
  ContinueFlag visit(EntryVisitor<K, V> visitor);
}
